package com.lmaos.allcontrol.beancontrol.paramInject_;

import java.lang.annotation.Annotation;
import java.lang.reflect.AccessibleObject;
import java.util.Map;

import com.lmaos.allcontrol.beancontrol.class_.ClassUtils;
import com.lmaos.allcontrol.beancontrol.entity_.LMClassParam;

public class InjectorParamsType extends InjectorTypeAbstract{
	
	@Override
	protected Object getParamValue(Map<Class, Annotation> methodAnns,Map<Class, Annotation> paramsAnnCache, AccessibleObject accessibleObject,int index, Class type, LMClassParam params) {
		InjectorTypeHandler injectorTypeHandler = getInjectorTypeHandler(type);
		if(injectorTypeHandler == null){
			return null;
		}
		Object[] defs = params.getDefalutValue();
		Object def = null;
		if(index < defs.length){
			def = defs[index];
//			if(def!=null&&!ClassUtils.isSuper(def.getClass(), type)&&type!=def.getClass()){
//				def = null;
//			}
		}
		return injectorTypeHandler.getObject(methodAnns,paramsAnnCache, accessibleObject, index,type,def, params);
	}

}
